package com.example.healkep.MainActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.example.healkep.LoginActivity;
import com.example.healkep.MainBg;
import com.example.healkep.FoodMainActivity;
import com.example.healkep.MainUser;
import com.example.healkep.R;

public class MainActivity extends Activity {
    public static String url= LoginActivity.url;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate ( savedInstanceState );
        setContentView ( R.layout.activity_main );
        //view层的控件和业务层的控件，靠id关联和映射  赋值，即设置布局文件中的Button按钮id进行关联
        Button select2 = (Button) findViewById ( R.id.select2 );
        Button select3 = (Button) findViewById ( R.id.select3 );
        Button select4 = (Button) findViewById ( R.id.select4 );
        Button main = (Button) findViewById ( R.id.mainchoose );
        Button food = (Button) findViewById ( R.id.food );
        Button sport = (Button) findViewById ( R.id.sports );
        Button sleep = (Button) findViewById ( R.id.sleep );


        //绑定监听事件
        select2.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                    // 给bnt1添加点击响应事件
                    Intent intent2 = new Intent ( MainActivity.this, FoodMainActivity.class );
                    //启动
                    startActivity ( intent2 );
            }
        } );

        select3.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                    // 添加点击响应事件
                    Intent intent3 = new Intent ( MainActivity.this, MainBg.class );
                    //启动
                    startActivity ( intent3 );
            }
        } );

        select4.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                    // 添加点击响应事件
                    Intent intent4 = new Intent ( MainActivity.this, MainUser.class );
                    //启动
                    startActivity ( intent4 );
            }
        } );

        main.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent5 = new Intent ( MainActivity.this, MainActivity2.class );
                //启动
                startActivity ( intent5 );
            }
        } );

        food.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent6 = new Intent ( MainActivity.this, MainActivityShowFood.class );
                //启动
                startActivity ( intent6 );
            }
        } );
        sleep.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent6 = new Intent ( MainActivity.this, MainActivityShowSleep.class );
                //启动
                startActivity ( intent6 );
            }
        } );
        sport.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent6 = new Intent ( MainActivity.this, MainActivityShowSport.class );
                //启动
                startActivity ( intent6 );
            }
        } );
    }
}